<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
      <el-table :data="rightsList" style="width: 100%" border stripe>
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column prop="id" label="ID" width="180"> </el-table-column>
        <el-table-column prop="authName" label="authName" width="180">
        </el-table-column>
        <el-table-column prop="pid" label="pid"> </el-table-column>
        <el-table-column prop="path" label="path"> </el-table-column>
        <el-table-column label="level">
          <template v-slot="scope">
            <el-tag v-if="scope.row.level == 0">一级</el-tag>
            <el-tag type="success" v-else-if="scope.row.level == 1"
              >二级</el-tag
            >
            <el-tag type="info" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { getRightsAPI } from '@/api'
export default {
  data() {
    return {
      rightsList: []
    }
  },
  created() {
    this.getRights()
  },
  methods: {
    async getRights() {
      // 获取权限 --- list数据
      const { data: res } = await getRightsAPI('list')
      //  console.log(res)
      this.rightsList = res.data
    }
  }
}
</script>

<style scoped></style>
